The Tab View Component > FTabView.replaceItemAt()

 

FTabView.replaceItemAt()

Availability

Flash Player 6.

Usage

myTab_tbv.replaceItemAt (index, item)

Parameters

index The index of the tab which should be replace with the new tab.

item A string or Object to associate with the new tab.

Returns


Nothing

Description

Replaces the tab at the specified index with a new tab with the specified label and data. Any data associated with the previous tab will be discarded. If a string is passed in as the second argument, a new object will be created and the string will be stored in the label property. If an Object is passed in as the second object, it will be used to populate the tab label. By default, the component will look for a property on the object named "label" to determine the tab name.

 

Notes

The name of the property that contains the name of the tab can be changed using the setLabelField method. The default value is "label".


Example

The tab_example2.fla example file contains an example of using this method.

The following code adds two tabs to the component, and then replaces the first tab with a new tab.

myTab_tbv.addItem( "Tab1" );
myTab_tbv.addItem( "Tab2" );
myTab_tbv.replaceItemAt( 0, "Tab3" );
trace( "Item: " + myTab_tbv.getItemAt( 0 ).label ); //traces "Item: Tab3"

 

See also

FTabView.setLabelField()

FTabView.addItem()

FTabView.addItemAt()

FTabView.setLabelField()